Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
JS, How can I remove text under conditions of starting at < and ending at >?

I have a text html document and I would like to delete all html code and leave all the plain text.

<p>Random text generated by some method</p>
<p style="text-align:center;">centered text example</p>
<p>Full name</p>
<p>IRSP</p>

output should be:

Random text generated by some method centered text example Full name IRSP

I'm kinda of a new so any docs related to this are welcome.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use a DOMParser to parse the string and get the result's textContent:

const str = `<p>Random text generated by some method</p>
<p style="text-align:center;">centered text example</p>
<p>Full name</p>
<p>IRSP</p>`

const res = new DOMParser().parseFromString(str, 'text/html').body.textContent;
console.log(res)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!